// 付款列表
var paymentColumns = [{
  id: 'time',
  title: '付款日期',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'name',
  title: '付款人',
  width: 74,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'price',
  title: '付款金额',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'no',
  title: '单据号',
  width: 140,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'msg',
  title: '付款说明',
  type: 'string',
  columnClass: 'text-left',
}, {
  id: 'operation',
  title: '操作',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-info" onclick="down('+record.id+')"><i class="icon-cloud-download"></i>  附件下载</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-success" onclick=""><i class="fa fa-edit"></i>  编辑</button>';
    return content;
  }
}];
var paymentOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  // loadURL:'url',
  exportFileName: '付款列表',
  datas: [{
    id: 1,
    time: '2019/01/02 12:00:11',
    name: '张三',
    price: '￥999,999,999.00元',
    no: 'NJSTS2123129291',
    msg: '付款说明测试数据',
  }, {
    id: 2,
    time: '2019/01/02 12:00:11',
    name: '张三',
    price: '￥999,999,999.00元',
    no: 'NJSTS2123129291',
    msg: '付款说明测试数据',
  }, ],
  columns: paymentColumns,
  gridContainer: 'paymentContainer',
  toolbarContainer: 'paymentToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var paymentGrid = $.fn.dlshouwen.grid.init(paymentOption);
$(function () {
  paymentGrid.load();
});

//文件下载权限事件
function down(id) {
  if (id > 1) {
    //询问框
    layer.confirm('权限不足，是否申请更高权限？', {
      title: '提示信息',
      btn: ['申请', '取消'] //按钮
    }, function () {
      layer.msg('申请成功', {
        icon: 1
      });
    });
  } else {
    //页面层
    layer.open({
      type: 1,
      skin: 'layui-layer-rim', //加上边框
      area: ['480px', 'auto'], //宽高
      title: '文件下载列表',
      content: '<div class="aper-layer">' +
        '<table class="table table-bordered" style="text-align: center;margin-bottom:0;">' +
        '<thead>' +
        '<tr><th>文件名称</th><th>版本号</th><th>上传时间</th><th>操作</th></tr>' +
        '</thead>' +
        '<tbody>' +
        '<tr><td>文件名称测试数据</td><td>v1.0</td><td>2019-02-03</td><td><a href="" download="">下载</a></td></tr>' +
        '</tbody>' +
        '</table>' +
        '</ul>' +
        '</div>'
    });
  }
}